package com.topvision.service.api.impl.glass;

import com.topvision.mapper.glass.SysversionMapper;
import com.topvision.model.glass.Sysversion;
import com.topvision.service.api.glass.AppSysVersionService;
import com.topvision.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("appSysVersionService")
public class AppSysVersionServiceImpl implements AppSysVersionService {
    @Autowired
    SysversionMapper sysversionMapper;

    /**
     * 获取最新的应用版本信息
     *
     * @param packageName 包名
     * @param platform    平台
     * @return
     */
    @Override
    public Sysversion getNewestVersion(@RequestParam String packageName, @RequestParam String platform) {
        Map<String, Object> map = new HashMap<>();
        map.put("packagename", packageName);
//        map.put("platform", platform);
        List<Sysversion> sysversionList = sysversionMapper.queryByParam(map);
        if (sysversionList != null && sysversionList.size() > 0) {
            return sysversionList.get(0);
        }
        return null;
    }
}
